package com.bjpowernode.p2p.service.loan.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.bjpowernode.p2p.constant.Loan;
import com.bjpowernode.p2p.constant.Page;
import com.bjpowernode.p2p.dao.LoanDao;
import com.bjpowernode.p2p.dao.ReportDao;
import com.bjpowernode.p2p.entity.LoanInfo;
import com.bjpowernode.p2p.service.loan.LoanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;

//进入Spring
@Component
//暴露服务
//版本号代表，可以有多个实现
//这里是第二个实现
@Service(interfaceClass = LoanService.class,version = "2.0")
public class LoanServiceImplA implements LoanService {

    @Autowired
    ReportDao reportDao;
    @Autowired
    LoanDao loanDao;


    @Override
    public double avgLoanRate() {
        return 100;
    }

    @Override
    public double sumBidMoney() {
        return 100;
    }

    @Override
    public List<LoanInfo> queryByproductType(HashMap<String, Object> paramMap) {
        paramMap.put(Loan.PRODUCT_TYPE,1);
        paramMap.put(Page.CURRENT_PAGE,0);
        paramMap.put("pageSize",1);
        return loanDao.findByproductType(paramMap);
    }
}
